package com.mystnihon.freeremote.loader.guide;

import org.apache.http.protocol.HttpContext;

import com.mystnihon.freeremote.util.NetworkConnection;
import com.mystnihon.freeremote.util.NetworkConnectionRequest;
import com.mystnihon.freeremote.util.NetworkConnectionResult;
import com.octo.android.robospice.request.SpiceRequest;

public class NetworkRequest extends SpiceRequest<NetworkConnectionResult> {
    private final HttpContext mHttpContext;
    private final NetworkConnectionRequest mNetworkConnectionRequest;

    public NetworkRequest(HttpContext hContext, NetworkConnectionRequest request) {
        super(NetworkConnectionResult.class);
        mHttpContext = hContext;
        mNetworkConnectionRequest = request;
    }

    @Override
    public NetworkConnectionResult loadDataFromNetwork() throws Exception {
        NetworkConnection network = new NetworkConnection();
        network.setHttpContext(mHttpContext);
        return network.wget(mNetworkConnectionRequest);
    }

}
